{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[14, 32, 50], [32, 77, 122], [50, 122, 194]]\n"
     ]
    }
   ],
   "source": [
    "matA = [[1,2,3],\n",
    "        [4,5,6],\n",
    "        [7,8,9]]\n",
    "matB = [[1,4,7],\n",
    "        [2,5,8],\n",
    "        [3,6,9]]\n",
    "\n",
    "M = len(matA)\n",
    "K = len(matA[0])\n",
    "N = len(matB[0])\n",
    "\n",
    "matC = [[0 for i in range(N) ] for i in range(M)]\n",
    "\n",
    "for i in range(M):\n",
    "    for j in range(N):\n",
    "        for k in range(K):\n",
    "            matC[i][j] += matA[i][k] * matB[k][j]\n",
    "            \n",
    "print(matC)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1, 4, 7], [2, 5, 8], [3, 6, 9]]\n",
      "[[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n"
     ]
    }
   ],
   "source": [
    "matD = [[1,4,7],\n",
    "        [2,5,8],\n",
    "        [3,6,9]]\n",
    "print(matD)\n",
    "\n",
    "dM = len(matD)\n",
    "dN = len(matD[0])\n",
    "\n",
    "matE = [[0 for i in range(dM) ] for i in range(N)]\n",
    "\n",
    "for i in range(dN):\n",
    "    for j in range(dM):\n",
    "        matE[i][j] = matD[j][i]\n",
    "\n",
    "print(matE)\n",
    "        "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
